{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "f3a0ab1a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'a': 'xiaohong', 'b': 'xiaoming', 'c': 'xiaodeng'}\n"
     ]
    }
   ],
   "source": [
    "info = {\n",
    "    \"a\":\"xiaohong\",\n",
    "    \"b\":\"xiaoming\",\n",
    "    \"c\":\"xiaodeng\",\n",
    "}\n",
    "print(info)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "5d5dfb7e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'a': 'xiaom', 'b': 'xiaoming', 'c': 'xiaodeng'}\n"
     ]
    }
   ],
   "source": [
    "info = dict(\n",
    "    a=\"xiaom\",\n",
    "    b=\"xiaoming\",\n",
    "    c=\"xiaodeng\",\n",
    ")\n",
    "print(info)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "ce4098da",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'a': 'xiaom', 'b': 'xiaoming', 'c': 'ciaoh'}\n"
     ]
    }
   ],
   "source": [
    "info_03 = {}\n",
    "info_03[\"a\"] = \"xiaom\"\n",
    "info_03[\"b\"] = \"xiaoming\"\n",
    "info_03[\"c\"] = \"ciaoh\"\n",
    "print(info)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "7c82ef01",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'a': 'xiaom', 'b': 'xiaoming', 'c': 'ciaoh', 'd': 'hj'}\n"
     ]
    }
   ],
   "source": [
    "info_03[\"d\"] = \"hj\"\n",
    "print(info_03)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "ea5be01b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'hj'"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "info_03[\"d\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "d41a0839",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "查询key不存在\n"
     ]
    }
   ],
   "source": [
    "\n",
    "if \"f\"in info_03:\n",
    "    print(info_03)\n",
    "else:\n",
    "    print(\"查询key不在\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "0a6ffcf3",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'a': 'xiaom', 'b': 'xiaoming', 'c': 'ciaoh', 'd': 'ch'}\n"
     ]
    }
   ],
   "source": [
    "if \"d\"in info_03:\n",
    "    info_03[\"d\"]=\"ch\"\n",
    "print(info_03)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "9ef910ea",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'a': 'xiaom', 'b': 'xiaoming', 'c': 'ciaoh'}\n"
     ]
    }
   ],
   "source": [
    "info_03.popitem()\n",
    "print(info_03)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "5b901f42",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'a': 'xiaom', 'b': 'xiaoming'}\n"
     ]
    }
   ],
   "source": [
    "info_03.popitem()\n",
    "print(info_03)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "1b2f3045",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'b': 'xiaoming'}\n"
     ]
    }
   ],
   "source": [
    "info_03.pop(\"a\")\n",
    "print(info_03)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c363226d",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
